load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "sslocal",
    srcs = [
        "cluster_settings.go",
        "sql_stats.go",
        "sql_stats_controller.go",
        "sslocal_iterator.go",
        "sslocal_provider.go",
        "sslocal_sink.go",
        "sslocal_stats_collector.go",
        "temp_sql_stats.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/sql/sqlstats/sslocal",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/server/serverpb",
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/sql/appstatspb",
        "//pkg/sql/clusterunique",
        "//pkg/sql/execstats",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/sql/sessionphase",
        "//pkg/sql/sqlstats",
        "//pkg/sql/sqlstats/insights",
        "//pkg/sql/sqlstats/ssmemstorage",
        "//pkg/util/log",
        "//pkg/util/metric",
        "//pkg/util/mon",
        "//pkg/util/stop",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_redact//:redact",
    ],
)

go_test(
    name = "sslocal_test",
    srcs = [
        "iterator_test.go",
        "main_test.go",
        "sql_stats_test.go",
    ],
    exec_properties = select({
        "//build/toolchains:is_heavy": {"test.Pool": "large"},
        "//conditions:default": {"test.Pool": "default"},
    }),
    deps = [
        ":sslocal",
        "//pkg/base",
        "//pkg/roachpb",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/security/username",
        "//pkg/server",
        "//pkg/server/serverpb",
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/sql",
        "//pkg/sql/appstatspb",
        "//pkg/sql/catalog/descs",
        "//pkg/sql/isql",
        "//pkg/sql/sem/catconstants",
        "//pkg/sql/sem/tree",
        "//pkg/sql/sessiondata",
        "//pkg/sql/sessiondatapb",
        "//pkg/sql/sessionphase",
        "//pkg/sql/sqlstats",
        "//pkg/sql/sqlstats/insights",
        "//pkg/sql/sqlstats/persistedsqlstats",
        "//pkg/sql/sqlstats/persistedsqlstats/sqlstatstestutil",
        "//pkg/sql/sqlstats/ssmemstorage",
        "//pkg/testutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/sqlutils",
        "//pkg/testutils/testcluster",
        "//pkg/util",
        "//pkg/util/ctxgroup",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/mon",
        "//pkg/util/stop",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "@com_github_jackc_pgx_v4//:pgx",
        "@com_github_stretchr_testify//require",
    ],
)
